<%@ page import="bean.Student" %>
<%@ page import="java.util.List" %>
<%@ page isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script>
        function del(id) {
            if (confirm("确认删除？")) {
                location.href="${pageContext.request.contextPath}/student/delete/"+id
                alert("删除成功")
            }
        }
    </script>
</head>
<body>
<table>
    <tr>
        <th>商品号</th>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>商品类型</th>
    </tr>

    <c:forEach items="${studentList}" var="student">

        <tr>
            <td>${student.id}</td>
            <td>${student.name}</td>
            <td>${student.age}</td>
            <td><a href="${pageContext.request.contextPath}/student/update/${student.id}">更新</a></td>
                <%--            <td><a href="${pageContext.request.contextPath}/student/delete/${student.id}">删除</a></td>--%>
            <td><a href="javascript:void(0)" onclick="del(${student.id})">删除</a></td>
        </tr>

    </c:forEach>
</table>
</body>
</html>
